/**
 * 
 */
package com.stryker;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.stryker.complaint.ScreenComplaint;
import com.stryker.newproject.ScreenNewProjectActivity;
import com.stryker.ultilities.Ultilities;

public class HomeActivity extends Activity implements OnClickListener{
	private ImageView btn_newProject;
	private Dialog progressDialog;
	private ImageView btn_complaint;
	/**
	 * Called when the activity is first created.
	 *
	 * @param savedInstanceState the saved instance state
	 */

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// this is code config full screeen
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		Ultilities.mLockScreenRotation(this);
		setContentView(R.layout.screen_home);
		
		progressDialog=Ultilities.showProgressDialog(this);
		
		btn_newProject=(ImageView)findViewById(R.id.btn_newProject);
		
		btn_newProject.setOnClickListener(this);
		
		btn_complaint = (ImageView)findViewById(R.id.btn_complaint);
		
		btn_complaint.setOnClickListener(this);
		
	}
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_newProject:
			final Handler mHandler = new Handler();
			progressDialog.show();

			new Thread() {
				public void run() {
					try {
						Runnable r = new Runnable() {
							public void run() {
								// do your background process
								 Intent it = new Intent(HomeActivity.this,
											ScreenNewProjectActivity.class);
									startActivity(it);
								overridePendingTransition(R.anim.slide_left, 0);
								progressDialog.cancel();
							}
						};
						mHandler.post(r);
					} catch (Exception e) {
					}
				}
			}.start();

			break;
		case R.id.btn_complaint:
			final Handler mHandlers = new Handler();
			progressDialog.show();

			new Thread() {
				public void run() {
					try {
						Runnable r = new Runnable() {
							public void run() {
								// do your background process
								 Intent it = new Intent(HomeActivity.this,
											ScreenComplaint.class);
									startActivity(it);
								overridePendingTransition(R.anim.slide_left, 0);
								progressDialog.cancel();
							}
						};
						mHandlers.post(r);
					} catch (Exception e) {
					}
				}
			}.start();

			break;
		default:
			break;
		}
		
	}
}
